import { ref } from 'vue'

const loading = ref(null)

export const openLoading = () => {
  loading.value = ElLoading.service({
    lock: true,
    text: '加载中...',
    background: 'rgba(0, 0, 0, 0.5)'
  })
}

export const closeLoading = () => {
  if (loading.value == null) {
    return
  }
  loading.value.close()
  loading.value = null
}
